<template>
    <div class="shop-cart-sticky" v-show="visible">
        <shop-cart
            ref="shopCart"
            :selectFoods="selectFoods"
            :deliveryPrice="deliveryPrice"
            :minPrice="minPrice"
            :fold="fold"
            :isSticky=true
            :isGoods="isGoods"
            @hide="hide"
            @show="show"
        >
        </shop-cart>
    </div>
</template>

<script>
    import ShopCart from 'components/shop-cart/shop-cart'
    import popupMixins from 'common/mixins/popup'

    export default {
        mixins: [popupMixins],
        name: 'shop-cart-sticky',
        props: {
            selectFoods: {
                type: Array,
                default() {
                    return []
                }
            },
            deliveryPrice: {
                type: Number,
                default: 0
            },
            minPrice: {
                type: Number,
                default: 0
            },
            /* 购物车列表是否隐藏 */
            fold: {
                type: Boolean,
                default: true
            },
            isGoods: {
                type: Boolean,
                default: false
            },
            /* 购物车列表 */
            list: {
                type: Object,
                default() {
                    return {}
                }
            }
        },
        methods: {
            drop(el) {
                this.$refs.shopCart.drop(el)
            }
        },
        components: {
            ShopCart
        }
    }
</script>

<style lang="stylus" scoped>
    .shop-cart-sticky
        position: absolute
        left: 0
        bottom: 0
        width: 100%
        height: 48px
        z-index: 999
</style>
